package org.lzy.shop.adapter

import android.content.Context
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import org.lzy.shop.R
import org.lzy.shop.response.FeedBackItem


class FeedBackAdapter: BaseQuickAdapter<FeedBackItem, QuickViewHolder>()  {


    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): QuickViewHolder {
        return QuickViewHolder(R.layout.item_feedack_all, parent)
    }

    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: FeedBackItem?) {
        item?.let {
            holder.setText(R.id.feedback_time, item.createTime)
            holder.setText(R.id.feed_content, item.content)
            val  orderPicAdapter=OrderPicAdapter()
            val  shopPicRv = holder.getView<RecyclerView>(R.id.pic_rv)
            shopPicRv.apply {
                layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
                adapter=orderPicAdapter
            }
            item.images.let { it1 ->
                if (it1 != null) {
                    if (it1.isNotEmpty()) {
                        orderPicAdapter.submitList(item.images)
                    }
                }
            }
        }


    }


}